pkgname=mce-log
pkgver=git
pkgrel=1
url="https://github.com/andikleen/mcelog"
arch=('x86_64' 'i386')
license=('GPL')
makedepends_debian_11=(bison flex)
source=("$pkgname"::"https://github.com/andikleen/mcelog.git" "https://git.kernel.org/pub/scm/utils/cpu/mce/mce-inject.git" "https://github.com/aegl/mce-test.git")
md5sums=('SKIP' 'SKIP' 'SKIP')

build()
{
	cd $srcdir/$pkgname

	make
	make -C ../mce-inject
	CPPFLAGS="" make -C ../mce-test
}

package()
{
	cd $srcdir/$pkgname

	mkdir -p "${pkgdir}/lkp/benchmarks/${pkgname}"
	cp -af * "${pkgdir}/lkp/benchmarks/${pkgname}" || return

	make destdir="$pkgdir" install -C ../mce-inject || return

	make install -C ../mce-test || return
	mkdir -p "${pkgdir}/usr/bin"
	cp ../mce-test/bin/page-types "${pkgdir}/usr/bin" || return
}
